package com.shop.service.admin;

import com.shop.dao.BaseDao;
import com.shop.dao.admin.AdminDapImplDao;
import com.shop.dao.admin.IAdminDao;
import com.shop.pajo.Admin;

import java.sql.Connection;
import java.sql.SQLException;

public class AdminServiceImpl implements IAdminService{
    private IAdminDao adminDao;

    public AdminServiceImpl() {
        adminDao = new AdminDapImplDao();
    }

    @Override
    public Admin getLoginAdmin(String name, String password) {
        Connection connection=null;
        Admin admin=null;
        try {
            connection= BaseDao.getConnection();
            //通过业务层调用对应的具体的数据库操作
            admin=adminDao.getLoginAdmin(connection, name,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally{
            BaseDao.closeResource(connection, null, null);
        }
        return admin;
    }
}
